﻿CREATE TABLE foo (fooid int, foosubid int, fooname text);
INSERT INTO foo VALUES (1, 1, 'Joe');
INSERT INTO foo VALUES (1, 2, 'Ed');
INSERT INTO foo VALUES (2, 1, 'Mary');

CREATE FUNCTION getfoo(int) RETURNS foo AS $$
    SELECT * FROM foo WHERE fooid = $1;
$$ LANGUAGE SQL;

SELECT *, upper(fooname) FROM getfoo(1) AS t1;


DROP FUNCTION getstudent(integer)
CREATE OR REPLACE FUNCTION getstudent(varchar(128)) RETURNS SETOF student AS $$
    SELECT * FROM student where "Display_Name" = $1;
$$ LANGUAGE SQL;


SELECT * FROM getstudent('Judy') AS t1;
